class PageResult<T> {
  final String current;
  final String size;
  final String total;
  final List<T> records;

  PageResult({
    required this.current,
    required this.size,
    required this.total,
    required this.records,
  });

  factory PageResult.fromJson(
    Map<String, dynamic> json,
    T Function(Map<String, dynamic>) fromJsonT,
  ) {
    return PageResult<T>(
      current: json['current'].toString(),
      size: json['size'].toString(),
      total: json['total'].toString(),
      records: (json['records'] as List<dynamic>)
          .map((item) => fromJsonT(item as Map<String, dynamic>))
          .toList(),
    );
  }
}
